//--------------在线下单 出口

//------------------------------提交
function submitForm(flag) {
    //	alert(flag);
    if (flag == '0' || flag == '6' || flag == '7' || flag == '4') {
        if (flag == '0') {
            $.messager.confirm("提示", "确定新增？", function (data) {
                if (data) {
                    //window.location.href ="exportDeclare_customs.do";
                    linkTab("exportDeclare_customs.do", "");
                }
            });
        } else if (flag == '6') {
            $.messager.confirm("提示", "确认跳到关检综合页面？", function (data) {
                if (data) {
                    var gjh = $('#GJH').val();
                    var gjglmm = $('#GJGLMM').val();
                    if (gjh != "") {
                        //window.location.href
                        // ="dataQuery_queryBygjh.do?flag=export&gjh="+gjh.trim()+"&gjglmm="+gjglmm.trim();
                        linkTab("dataQuery_queryBygjh.do?flag=export&gjh=" + gjh.trim()
                                + "&gjglmm=" + gjglmm.trim(), gjh.trim());
                    } else {
                        //window.location.href="exportDeclareAndInspect_query.do";
                        linkTab("exportDeclareAndInspect_query.do", "");

                    }
                }
            });
        } else if (flag == '7') {
            $.messager.confirm("提示", "确定跳到报检单页面？", function (data) {
                if (data) {
                    var baHgbaseinfoId = $("#baHgbaseinfoId").val();
                    if (baHgbaseinfoId != "") {
                        var gjh = $('#GJH').val();
                        var gjglmm = $('#GJGLMM').val();
                        //window.location.href
                        // ="exportInspect_queryByGjhAndGjglmm.do?jyjy.gjh="+gjh.trim()+"&jyjy.gjglmm="+gjglmm.trim();
                        linkTab("exportInspect_queryByGjhAndGjglmm.do?jyjy.gjh=" + gjh.trim()
                                + "&jyjy.gjglmm=" + gjglmm.trim(), gjh.trim());

                    } else {
                        //window.location.href ="exportInspect_exportInspect.do";
                        linkTab("exportDeclareAndInspect_query.do", "");
                    }
                }
            });
        } else if (flag == '4') {
            if ($("#myForm").valid()) {
                hgDeclareUrl = "exportDeclare_hgDeclare.do";
                //openHgZhuJian();
                alert("稍后开放，敬请期待！");
            }
        }
    } else {
        var islock = $("#HGISLOCK").val();
        if (flag == '1') {
            var requiredsElment = getRequiredElement();
            removeRequiredForRequiredsElment(requiredsElment);
            if ($("#myForm").valid()) {
                ajaxSubmit("/order/save", "myForm"); //报关单 暂存
            }
            addRequiredForRequiredsElment(requiredsElment);

        } else if (flag == '3') {
            selectAddSelectRequired();
            if ($("#myForm").valid()) {
                ajaxSubmit("/order/submit", "myForm", "callbackeee");
            }
        }

    }
}

function callbackeee(id) {
    location.href = "/business/declaration-confirmPay?declaration_id=" + id;
}

function ajaxSubmit(url, formId, callback) {
    //ajaxSubmitBase(url, formId, "", "entryHgAjaxCallBack");
    ajaxSubmitBase(url, formId, "", callback);
}

//------------------页面加载时执行
$(function () {

    //判断运费、保费、杂费是否为率。是则币制改为不可选，否则可选。
    if ("" == "1") {
        $("#HGSB-YFBZ").attr("readonly", "readonly");

    }
    if ("" == "1") {
        $("#HGSB-BFBZ").attr("readonly", "readonly");
    }
    if ("" == "1") {
        $("#HGSB-ZFBZ").attr("readonly", "readonly");
    }

    //商品、集装箱、随附单证初始列。
    attaSerIdIndex = '0';
    boxSerIdIndex = '0';
    hggoodsSerIdIndex = '1';
    setGoodsSpxhId(hggoodsSerIdIndex);
});
//--------------------显示隐藏密码
function ps() {
    $("#GJGLMM")[0].type = "text";
    $("#showButton").attr("onclick", "txt();");
    $("#showButton").val("隐藏密码");
}

function txt() {
    $("#GJGLMM")[0].type = "password";
    $("#showButton").attr("onclick", "ps();");
    $("#showButton").val("显示密码");
}
checkAuthority();


